/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = activemq_common.h                                  */
/*  NOTE      =                                                    */
/*  DATE      = 2015/04/28 by geyh                                 */
/*******************************************************************/

#ifndef __ACTIVEMQ_COMMON_H_
#define __ACTIVEMQ_COMMON_H_

#include "frbyte_buffer.h"
#include "activemq_base_type.h"
#include "activemq_core.h"

int activeMQ_boolean_stream_get(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean **pp_st_boolean, L7session_activeMQ_private *p_st_private);
int activeMQ_boolean_stream_parse(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean);
int activeMQ_get_data(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, const char *p_field_name, int *p_i_value);
//int activeMQ_get_data2(Frbyte_Packet *p_st_data, void **pp_output, int i_data_type);

//int activeMQ_get_string(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean
//                    , Frreport_body_data *p_st_body_data
//                    , const char *p_field_name, int i_use_request);

//int activeMQ_get_int(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data
//                , const char *p_field_name, int i_use_request);

int activeMQ_get_time(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean
                    , Frreport_body_data *p_st_body_data
                    , const char *p_field_name, int i_use_request, int is_topic, long long *p_l_time);

//int activeMQ_get_boolean(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, Frreport_body_data *p_st_body_data
//                    , const char *p_field_name, int i_use_request);

int activeMQ_get_byte(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data
                    , const char *p_field_name, int i_use_request, int is_topic);

//int activeMQ_get_bytes(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, Frreport_body_data *p_st_body_data
//                    , const char *p_field_name, int i_use_request);

int get_response_required(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, Frreport_body_data *p_st_body_data
                    , L7session_activeMQ_private *p_st_private);

int activeMQ_get_command_id(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data);
int activeMQ_get_cache_index(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, int i_flag_tightmarshal);
int get_broker_id(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_connection_id(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_session_id(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_consumer_id(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_activemq_destination(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_original_destination(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int skip_producer_id(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_local_transaction_id(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);

int skip_transaction_id(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_object_id(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int get_activemq_message(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int skip_message_id(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);

int get_destination(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);

int activeMQ_get_user(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean
                    , Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private);

int activeMQ_get_pass(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean
                    , Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private);

int activeMQ_skip_boolean(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean);
int activeMQ_skip_string(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean);
int skip_destination(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int skip_active_destination(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);
int skip_consumer_id(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private);

int activeMQ_skip_throwable(Frbyte_Packet *p_st_data, ACTIVEMQ_boolean *p_st_boolean
                            , L7session_activeMQ_private *p_st_private, int i_flag_stacktraceEnabled);
#endif
